/**
  * This file is part of Medusa.
  *
  * Authors: Uriel Fanelli <uriel.fanelli@gmail.com>
  *          Perthect <perthect@gmail.com>
  *          Marco Bizzarri <Marco.Bizzarri@gmail.com>
  *
  *
  * Medusa is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.

  * Medusa is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.

  * You should have received a copy of the GNU General Public License
  * along with Medusa; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */

#include "login.h"

logindialog::logindialog(QWidget *fnstr)
{
}

void logindialog::login_()
 {
    extension=new QWidget;
    mainLayout = new QGridLayout;
    topLayout = new QHBoxLayout;
    midLayout = new QHBoxLayout;
    botLayout = new QHBoxLayout;
    label = new QLabel(tr("Email:"));
    label1 = new QLabel(tr("Password:"));
    lineEdit = new QLineEdit;
    lineEdit1 = new QLineEdit;
    lineEdit1->setEchoMode(QLineEdit::Password);
    ok = new QPushButton(tr("&OK")); //ok->setDefault(true);
    ok->setIcon(QIcon(":/resources/icons/sent.png"));
    cancel = new QPushButton(tr("&Cancel"));
    gogoog = new QPushButton(tr("&Google"));
    gogoog->setIcon(QIcon(":/resources/icons/qtasterisk.png"));
    label->setBuddy(lineEdit);
    label1->setBuddy(lineEdit1);
    topLayout->addWidget(label);
    topLayout->addWidget(lineEdit);
    midLayout->addWidget(label1);
    midLayout->addWidget(lineEdit1);
    botLayout->addWidget(ok);
    botLayout->addWidget(cancel);
    botLayout->addWidget(gogoog);
    mainLayout->setSizeConstraint(QLayout::SetFixedSize);
    mainLayout->addLayout(topLayout, 0, 0);
    mainLayout->addLayout(midLayout, 1, 0);
    mainLayout->addLayout(botLayout, 2, 0);
    extension->setLayout(mainLayout);
    extension->setWindowTitle("Login");
    extension->setWindowIcon(QIcon(":/resources/icons/login.png"));
    extension->show();
    connect(ok,SIGNAL(clicked()),this,SLOT(login_ok()));
    connect(cancel,SIGNAL(clicked()),this,SLOT(login_cancel()));
    connect(gogoog,SIGNAL(clicked()),this,SLOT(login_gogoog()));
}

void logindialog::login_ok()
{
    extension->setWindowTitle(lineEdit->text()+"::"+lineEdit1->text());
    //extension->hide();
}

void logindialog::login_cancel()
{
    extension->hide();
}

void logindialog::login_gogoog()
{
    //newqtab->aggiungitab(QUrl("http://groups.google.com/"),QIcon(":/resources/icons/login.png"),tr("LoginGoogle"));
    extension->hide();
}
